<?php

/**
 * Thirdparties form base class.
 *
 * @package    tvpv
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormGeneratedTemplate.php 12815 2008-11-09 10:43:58Z fabien $
 */
class BaseThirdpartiesForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'cif'          => new sfWidgetFormInput(),
      'name'         => new sfWidgetFormInput(),
      'address'      => new sfWidgetFormInput(),
      'contactcomm'  => new sfWidgetFormInput(),
      'contactfact'  => new sfWidgetFormInput(),
      'payrule'      => new sfWidgetFormInput(),
      'faxnumber'    => new sfWidgetFormInput(),
      'phonenumber'  => new sfWidgetFormInput(),
      'mobilenumber' => new sfWidgetFormInput(),
      'email'        => new sfWidgetFormInput(),
      'webpage'      => new sfWidgetFormInput(),
      'notes'        => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorPropelChoice(array('model' => 'Thirdparties', 'column' => 'id', 'required' => false)),
      'cif'          => new sfValidatorString(array('max_length' => 255)),
      'name'         => new sfValidatorString(array('max_length' => 255)),
      'address'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'contactcomm'  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'contactfact'  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'payrule'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'faxnumber'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'phonenumber'  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'mobilenumber' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'email'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'webpage'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'notes'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorAnd(array(
        new sfValidatorPropelUnique(array('model' => 'Thirdparties', 'column' => array('cif'))),
        new sfValidatorPropelUnique(array('model' => 'Thirdparties', 'column' => array('name'))),
      ))
    );

    $this->widgetSchema->setNameFormat('thirdparties[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Thirdparties';
  }


}
